package com.qf.smsplatfrom.controller;

import com.qf.smsplatfrom.dto.R;
import com.qf.smsplatfrom.pojo.TDescribe;
import com.qf.smsplatfrom.service.DescribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/describe")
public class DescribeController {

    private DescribeService describeService;

    @Autowired
    public void setDescribeService(DescribeService describeService) {
        this.describeService = describeService;
    }

    @RequestMapping("/add")
    public R addDescribe(@RequestBody TDescribe tDescribe) {
        describeService.addDescribe(tDescribe);
        return R.setOk();
    }

    @RequestMapping("/modify")
    public R modifyDescribe(@RequestBody TDescribe tDescribe) {
        describeService.modifyDescribe(tDescribe);
        return R.setOk();
    }

    @RequestMapping("/remove")
    public R removeDescribe(@RequestBody Map map) {
        describeService.removeDescribe(((List<Long>) map.get("ids")));
        return R.setOk();
    }
}
